﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using blackhouse.Currencies;
using System.Globalization;

namespace blackhouse.BlackApart.Business.Company {
	public class ImpCompany : ICompany {

		public CompanyCounts Counts { get; set; }
		public ApartmentPromotionBaner[] Banners { get; set; }
		public CompanyLanguage[] Languages { get; set; }

		public CompanyCounts GetCounts() {
			return this.Counts;
		}

		public ApartmentPromotionBaner[] GetBanners() {
			return this.Banners;
		}

		public Currency GetCurrentUserCurrency() {
			return this.GetCurrentUserCurrency(1);
		}

		public Currency GetCurrentUserCurrency(double withValue) {
			if (this.Languages != null) {
				CompanyLanguage cl = this.Languages.FirstOrDefault(c => c.Language.Name == CultureInfo.CurrentCulture.Name);
				if (cl == null)
					return new Currency(withValue, "EUR");
				else
					return new Currency(withValue, cl.Currency);
			}
			else return null;
		}

	}
}
